package com.zb.address.controller;


import com.zb.result.Result;
import com.zb.service.ZjAddressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author WEN
 * @since 2023-08-11
 */
@Api(tags = "地址类接口")
@RestController
@RequestMapping("/address")
public class ZjAddressController {
    @Resource
    private ZjAddressService addressService;

    @ApiOperation("获取一级地址")
    @GetMapping("/")
    public Result getAddress() {
        return Result.success("获取地址成功！").data("rows", addressService.getAddress());
    }

    @ApiOperation("获取子级地址")
    @GetMapping("/{parentId}")
    public Result getChildAddress(@PathVariable @ApiParam(value = "父级ID", required = true) String parentId) {
        return Result.success("获取子级地址成功！").data("rows", addressService.getChildAddress(parentId));
    }



}
